package com.xiaoyu.serviceImpl;

import com.xiaoyu.ScoreDao;
import com.xiaoyu.model.Score;
import com.xiaoyu.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ScoreServiceImpl implements ScoreService {
    @Autowired
    private ScoreDao scoreDao;

    @Override
    public List<Score> allScore(Score score) {
        return scoreDao.findScore(score);
    }

    @Override
    public Boolean deleteScore(Score score) {
        if (scoreDao.deleteScore(score)==1)
            return true;
        return false;
    }

    @Override
    public Boolean updateScore(Score score) {
        if (scoreDao.updateScore(score)==1)
            return true;
        return false;
    }

    @Override
    public Boolean addScore(Score score) {
        if(scoreDao.addScore(score)==1)
            return true;
        return false;
    }

    @Override
    public Score findOneScore(Score score) {
        return scoreDao.findOneScore(score);
    }

    @Override
    public List<Integer> allScoreName() {
        return scoreDao.findScoreName();
    }
}
